package leetcode.d1;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @Author: hang an
 * @Date: 2025/5/15
 * @Description:
 */
public class R3541 {
    public int maxFreqSum(String s) {
        Set<Integer> set = new HashSet<>();
        set.add(0);
        set.add('e'-'a');
        set.add('i'-'a');
        set.add('o'-'a');
        set.add('u'-'a');

        char[] charArray = s.toCharArray();
        int[] cnt = new int[26];
        for (char c : charArray) {
            cnt[c- 'a']++;
        }
        List<Integer> v = new ArrayList<>();
        List<Integer> nv = new ArrayList<>();
        for (int i = 0; i < 26; i++) {
            if (set.contains(i)) {
                v.add(cnt[i]);
            } else {
                nv.add(cnt[i]);
            }
        }
        return v.stream().max(Integer::compare).get() + nv.stream().max(Integer::compare).get();
    }
}
